<?php

namespace App\Models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class VolunteerForm
 * *
 * @property $id  自增ID
 * @property $volunteer_id  志愿活动id
 * @property $name  姓名
 * @property $sex  性别 0:未知 1:男 2:女
 * @property $age  年龄
 * @property $phone  手机号码
 * @property $id_card  身份证
 * @property $work_unit  工作单位
 * @property $address  住址
 * @property $audit_status  审核状态 0:待审核 1:已审核 2:拒绝
 * @property $add_uid  添加者uid
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 *
 * @package  App\Models
 * @mixin \Illuminate\Database\Eloquent\Builder
 */
class VolunteerForm extends Model
{
    use SoftDeletes;

    protected $table = 'volunteer_forms';

    protected $fillable = ['id', 'volunteer_id', 'name', 'sex', 'age', 'phone', 'id_card', 'work_unit', 'address', 'audit_status',
        'add_uid'];
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function activity()
    {
        return $this->belongsTo(VolunteerActivity::class, 'volunteer_id');
    }
}
